<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/7
 * Time: 15:16
 */
header('Content-Type:application/json');
include '../classes/conn.php';
include "../classes/logincheck.php";
if(islogin()=="teacher_login"){
    $query_stu="select num,name from student where class='".$_POST['class_num']."' and teacher='".$_SESSION['t_num']."'";
    $query_section="select num,name from section where class='".$_POST['class_num']."' and teacher='".$_SESSION['t_num']."'";

//查询学生名单
    $result=mysql_query($query_stu);
    $res_stu=array();
    while ($row=mysql_fetch_assoc($result)){
        $res_stu[]=$row;
    }
    $data=urlencode(json_encode($res_stu));
    $data=urldecode($data);
    echo  $data;
}

//$res_stu=array('stu'=>$res_stu);
////班级查询课程章节
//$result=mysql_query($query_section);
//$res_section=array();
//while ($row=mysql_fetch_assoc($result)){
//    $res_section[]=$row;
//}
//$res_section=array('section'=>$res_section);
//$data=array_merge($res_section,$res_stu);
//$data=json_encode($data);
//echo $data;
//$stu_data=urlencode(json_encode($res_stu));
//$stu_data=urldecode($stu_data);
////echo $stu_data;
//$section_data=urlencode(json_encode($res_section));
//$section_data=urldecode($section_data);
////echo $section_data;